<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('reports', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->constrained()->onDelete('cascade');
            $table->integer('influencer_id')->constrained()->onDelete('cascade');
            $table->string('type')->comment('举报类型');
            $table->text('content')->comment('举报内容');
            $table->json('evidence')->nullable()->comment('证据（图片/视频URL）');
            $table->enum('severity_level', ['low', 'medium', 'high', 'critical'])
            ->default('medium')->comment('严重程度');
            $table->timestamp('processed_at')->nullable()->comment('处理时间');
            $table->text('admin_remark')->nullable()->comment('管理员备注');
            $table->timestamps();
            $table->softDeletes();

            // 创建索引
            $table->index(['user_id', 'influencer_id']);
            $table->index('severity_level');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('reports');
    }
}; 